
$(function () {

    var anime = document.getElementById('anime_name');
    var anime_id = $(anime).attr('data_id');
    var anime_name = anime.innerText;
    var anime_class = $(anime).attr('data_class');
    console.log(anime_id, anime_name,anime_class);
    let sDataParams = {
        'anime_id': anime_id,
        'anime_name': anime_name,

    };

    $.ajax({
        url: "/player/" + anime_name+'/'+anime_class+'/',
        type: "GET",
        contentType: "application/json; charset=utf-8",
        data: sDataParams,
        dataType: "json",
    })
        .done(function (res) {
            console.log(res,'aaaa')
               const dp = new DPlayer({
                container: document.getElementById('dplayer'),
                video: {
                    url: res.anime_url,
                    type: 'customFlv',
                    customType: {
                        'customFlv': function (video, player) {
                            const flvPlayer = flvjs.createPlayer({
                                type: 'flv',
                                url: video.src
                            });
                            flvPlayer.attachMediaElement(video);
                            flvPlayer.load();
                        }
                    }
                }
            });
        });
});

